package com.ygh.controller;

import com.ygh.pojo.CarInfo;
import com.ygh.service.CarInfoService;
import com.ygh.vo.PageResult;
import com.ygh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@CrossOrigin
@RequestMapping("/vipinformation")
public class CarInfoController {
    @Autowired
    private CarInfoService carInfoService;

    @GetMapping("/{vipToken}")
    public SysResult findVip(@PathVariable String vipToken){
            List<CarInfo> list =carInfoService.finVip(vipToken);
            return SysResult.success(list);
    }

    @GetMapping("/findallcar")
    public SysResult findallcar(PageResult pageResult){
        pageResult=carInfoService.findallcar(pageResult);
                 return SysResult.success(pageResult);
    }

    @PutMapping("/updateStatus")
    public SysResult updateStatus(@RequestBody CarInfo carInfo){
        CarInfo carInfo1=carInfoService.updateStatus(carInfo);
        return SysResult.success(carInfo1);
    }

    @GetMapping("/mystatus/{carId}")
    public SysResult findmystatus(@PathVariable String carId){
             List<CarInfo> list=carInfoService.findmystatus(carId);
             return SysResult.success(list);
    }



}
